//
//  BanBu_ChatBgCell.m
//  BanBu
//
//  Created by Wang Xj on 13-7-25.
//
//

#import "BanBu_ChatBgCell.h"
typedef enum
{
    ChatNone = 0,
    ChatImageType,
    ChatGIFType

} ChatBGType;

@implementation BanBu_ChatBgCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
    }
    return self;
}

-(void)setType:(NSInteger)type
{
    if (type == 1)
    {
        self.photoButton.hidden = YES;
        self.backgroundColor = [UIColor clearColor];
        
        if (!self.imageView1)
        {
            self.imageView1 = [[[UIImageView alloc]initWithFrame:CGRectMake(15,5, 90, 90)] autorelease];
        }
        self.imageView1.userInteractionEnabled = YES;
       
     
       
        if (!self.imageView2)
        {
            self.imageView2 = [[[UIImageView alloc]initWithFrame:CGRectMake(115,5, 90, 90)] autorelease];
        }
        self.imageView2.userInteractionEnabled = YES;
        
        
        
        if (!self.imageView3)
        {
            self.imageView3 = [[[UIImageView alloc]initWithFrame:CGRectMake(215,5, 90, 90)] autorelease];
        }
        self.imageView3.userInteractionEnabled = YES;
        
        
        [self addSubview:self.imageView1];
        [self addSubview:self.imageView2];
        [self addSubview:self.imageView3];
        self.imageView1.hidden = NO;
        self.imageView2.hidden = NO;
        self.imageView3.hidden = NO;
        self.GIFImageView1.hidden = YES;
        self.GIFImageView2.hidden = YES;
        self.GIFImageView3.hidden = YES;
    }
    else if(type == 2)
    {
        self.photoButton.hidden = YES;
        self.backgroundColor = [UIColor clearColor];
        
        if (!self.GIFImageView1)
        {
            self.GIFImageView1 = [[[SCGIFImageView alloc]initWithFrame:CGRectMake(15,5, 90, 90)] autorelease];
        }

        self.GIFImageView1.userInteractionEnabled = YES;
        self.GIFImageView1.tag = 4;

        
        if (!self.GIFImageView2)
        {
            self.GIFImageView2 = [[[SCGIFImageView alloc]initWithFrame:CGRectMake(115,5, 90, 90)] autorelease];
        }
        self.GIFImageView2.userInteractionEnabled = YES;
        self.GIFImageView2.tag = 5;
        
       
        if (!self.GIFImageView3)
        {
            self.GIFImageView3 = [[[SCGIFImageView alloc]initWithFrame:CGRectMake(215,5, 90, 90)] autorelease];
        }
        self.GIFImageView3.userInteractionEnabled = YES;
        self.GIFImageView3.tag = 6;
        
        [self addSubview:self.GIFImageView1];
        [self addSubview:self.GIFImageView2];
        [self addSubview:self.GIFImageView3];
        
        self.GIFImageView1.hidden = NO;
        self.GIFImageView2.hidden = NO;
        self.GIFImageView3.hidden = NO;

        self.imageView1.hidden = YES;
        self.imageView2.hidden = YES;
        self.imageView3.hidden = YES;
    }
    else
    {
        
        self.photoButton.hidden = YES;
        self.imageView1.hidden = YES;
        self.imageView2.hidden = YES;
        self.imageView3.hidden = YES;
        self.GIFImageView1.hidden = YES;
        self.GIFImageView2.hidden = YES;
        self.GIFImageView3.hidden = YES;
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(void)dealloc
{
    [_photoButton release],_photoButton=nil;
    [_imageView1 release],_imageView1=nil;
    [_imageView2 release],_imageView2=nil;
    [_imageView3 release],_imageView3=nil;
    [_GIFImageView1 release],_GIFImageView1=nil;
    [_GIFImageView2 release],_GIFImageView2=nil;
    [_GIFImageView3 release],_GIFImageView3=nil;
    [super dealloc];
}

@end
